package com.yckj.day07;
public class Son2 extends Father2{
    public int age2 = getAge2();
    {
        System.out.println("子类构造块1");
    }

    // 父类静态属性
    static int num2 = getNum2();

    static{
        System.out.println("子类静态代码块1");
    }

    {
        System.out.println("子类构造代码块2");
    }

    public static int getNum2(){
        System.out.println("getNum()....执行了，子类静态属性赋值了");
        return 23;
    }

    public int getAge2(){
        System.out.println("子类的非静态方法执行了，给非静态属性赋值了");
        return 33;
    }

    public Son2() {
        System.out.println("子类无参构造方法。。");
    }

    public Son2(int age) {
        System.out.println("子类有参构造方法。。。");
        this.age2 = age;
    }
}